package bma.common.langutil.pipeline;

/**
 * 通用通道队列的执行上下文
 * 
 * @author 关中
 * @since 1.0 (imported from BMA.ESP Project)
 * 
 * @param <TYPE>
 */
public class CommonPipelineContext<TYPE> {

	protected volatile CommonPipelineContext<TYPE> next;
	protected volatile CommonPipelineContext<TYPE> prev;
	protected final String name;
	protected final TYPE item;

	public CommonPipelineContext(CommonPipelineContext<TYPE> prev,
			CommonPipelineContext<TYPE> next, String name, TYPE item) {
		if (name == null) {
			throw new NullPointerException("name");
		}
		if (item == null) {
			throw new NullPointerException("item");
		}
		this.prev = prev;
		this.next = next;
		this.name = name;
		this.item = item;
	}

	public TYPE getItem() {
		return item;
	}

	public String getName() {
		return name;
	}

	public CommonPipelineContext<TYPE> next() {
		return this.next;
	}

	public CommonPipelineContext<TYPE> prev() {
		return this.prev;
	}

}